/**   
 * @Title: ConListAdapter.java 
 * @Package com.cdtv.home.adapter 
 * @Description: 
 * @author zhuw
 * @date 2012-7-18 下午3:27:20 
 */
package com.chat.adapter;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.app.DemoApplication;
import com.contact.ADData;
import com.matang.R;

/**
 * 
 * @ClassName:PyqListAdapter
 * @Description:TODO
 * @author zhuw
 * @date 2014-5-19 下午5:08:31
 */
public class VedioListAdapter extends BaseAdapter {
	private List<ADData> list = new ArrayList<ADData>();
	private Context mContext;
	/**
	 * @param list
	 * @param context
	 */

	public VedioListAdapter( Context context) {
		super();
	
		this.mContext = context;
	}

	@Override
	public int getCount() {
		return list.size();
	}

	@Override
	public Object getItem(int position) {
		return list.get(position);
	}

	@Override
	public long getItemId(int position) {
		return 0;
	}

	@Override
	public View getView(int position, View view, ViewGroup parent) {
		ADData adData = list.get(position);
		ViewHolder vh = null;
		if (view == null) {
			view = LayoutInflater.from(mContext).inflate(
					R.layout.item_vedio, null);
			vh = new ViewHolder();
			vh.tvName = (TextView) view.findViewById(R.id.tv_vedio);
			vh.tvTime = (TextView) view.findViewById(R.id.tv_time);
			
	
			view.setTag(vh);
		} else {
			vh = (ViewHolder) view.getTag();
		}
			vh.tvTime.setText(adData.startTime);
			vh.tvName.setText(adData.title);
				return view;
	}
	public void clearData(){
		list.clear();
		notifyDataSetChanged();
	}
	public void addData(List<ADData> list){
		this.list = list;
		notifyDataSetChanged();
	}
	class ViewHolder {
		TextView tvName;
		TextView tvTime;

	}

}
